#ifndef SCI_DLL_CLASS
#define SCI_DLL_CLASS
#pragma once
#ifndef NULL
#ifdef __cplusplus
#define NULL    0
#else
#define NULL    ((void *)0)
#endif
#endif

#include "SciTypes.h"	
		
#define SCI_DLL_EXPORTS __declspec(dllexport)

struct SciScratchFeature
{
	double minValue;
	double maxValue;
	SciScratchFeatureType FeatureType;
};
struct SciColorRGBA
{
	int red;
	int green;
	int blue;
	int alpha;
};

struct SciScratchPrecessing
{
	SciScratchObjectType  lightDark;
	float  threshOffset;
	int  lowThresh;
	int  highThresh;
	SciScratchMorphType  morphType;
	int  morphIterations;
};
struct SciBarCodeQuality15416
{
	double Overall;
	double Decode;
	double SymbolContrast;
	double MinimalReflectance;
	double MinimalEdgeContrast;
	double Modulation;
	double Defects;
	double Decodability;
};

struct SciQRCodeQuality15415
{
	int overallQuality;
	int decodeGrade;
	int contrastGrade;
	int fixedPatternDamageGrade;
	int modulationGrade;
	int reflectanceMarginGrade;
	int unusedErrCorrectionGrade;
	int axialNonuniformityGrade;
	int gridNonuniformityGrade;
	int formatInformationGrade;
	int versionInformationGrade;
	float contrastUniformity;
	float printGrowth;
	float aperture;
};

struct SciDMCodeQuality15415
{
	int overallQuality;
	int decodeGrade;
	int contrastGrade;
	int fixedPatternDamageGrade;
	int modulationGrade;
	int reflectanceMarginGrade;
	int unusedErrCorrectionGrade;
	int axialNonuniformityGrade;
	int gridNonuniformityGrade;
	float contrastUniformity;
	float printGrowth;
	float aperture;
};



struct SciPDF417CodeQuality15415
{
	int overallQuality;
	int decode;
	int contrast;
	int fixPattern;
	int modulation;
	int unusedErrCorrection;
	int axialNonuniformity;
	int gridNonuniformity;
	int startStopPattern;
	int codewordYield;
	int defects;
	float aperture;

};
struct  SciDMCodeQuality29158
{
	int overallQuality;
	int	decode;
	int	cellContrast;
	int	cellModulation;
	int	reflectanceMargin;
	int	fixedPatternDamage;
	int axialNonuniformity;
	int	gridNonuniformity;
	int	unusedErrorEorrection;
	float contrastUniformity;
	float meanLight;
	float printGrowth;
	float aperture;
};


struct SciQRCodeQuality29158
{
	int overallQuality;
	int decode;
	int cellContrast;
	int cellModulation;	
	int fixedPatternDamage;	
	int reflectanceMargin;
	int unusedErrCorrection;
	int axialNonuniformity;
	int gridNonuniformity;
	int formatInformation;
	int versionInformation;
	float contrastUniformity;
	float meanLight;
	float printGrowth;
	float aperture;
};
struct SciDMCodeQualityAS9132
{
	int overallQuality;
	int quietZone;
	int symbolContrast;
	int angularDistortion;
	int moduleFill;
};
struct SciDLDMCodeParam{

	int polarity = 0; //极性 0表示自动，1表示深色符号浅色背景，2表示浅色符号深色背景	
	int shape = 0;    //样式 范围：[-3,29],-3为长方形自动，-2为正方形自动，-1为形状自动
	int downsample = 0; //降采样，范围：[0-5]
	int mirror = 0; //镜像 0表示自动，1表示常规，2表示镜像
};
struct SciDLQRCodeParam{

	int polarity = 0;//极性 0表示自动，1表示深色符号浅色背景，2表示浅色符号深色背景	
	int version = 0;  //版本 范围是：[0,40]
	int downsample = 0; //降采样，范围：[0-5]
	int mirror = 0; //镜像 0表示自动，1表示常规，2表示镜像
	int model = 0;  //0表示自动, 1表示model 1，2表示model 2	
};
struct SciDLBarCodeParam{

	int polarity = 1; //极性 1表示深色符号浅色背景，2表示浅色符号深色背景	
	int downsample = 0; //降采样，范围：[0-2]
	int decodeThresh = 8; //解码阈值
	bool code39Check = false; //开启code39校验
	bool ITFCheck = false; //开启ITF校验
};
struct SciDLDecodeParam{
	SciCodeType codeType;  //码制
	SciDLDMCodeParam dmParam;
	SciDLQRCodeParam qrParam;
	SciDLBarCodeParam barParam;
	int TimeOut = 500;   //超时
	int CodeNumber = 1;    //数量		 
	bool outputErrorPoints = false; //输出提取到的错误点
	bool outputModuleArray = false; //输出前景背景模块点
	bool outputLocationResult = false; //输出定位结果
	bool Enable15415 = false; //开启15415质量评估
	bool Enable29158 = false; //开启29158质量评估
	bool Enable15416 = false; //开启15416质量评估
};

struct SciEvaluateResult_CPK
{
	double usl;  //Upper Specification Limit
	double lsl;  //Lower Specification Limit

	double tarVal; //Target value
	double x_bar;  //均差的均值
	double r_bar;  //极差的均值
	double s_bar;  //标准差均值
	double max_val;//样本最大值
	double min_val;//样本最小值
	int groupNum; //组数
	int groupSize; //组容量

	double ca;  //制程准确度
	//能力指数
	double cp;//基本过程能力指数
	double cpu;//只有规格上限和规格中心的过程能力指数
	double cpl;//只有规格下限和规格中心的过程能力指数
	double cpk;//过程能力指数
	double cpm; //质量损失函数的过程能力指数

	//性能指数
	double pp;//整体样本cp
	double ppu;//整体样本cpu
	double ppl;//整体样本cpl
	double ppk;//整体样本cpk
	int stdType; //标准差类型
	double lcl_x; //下控制限
	double ucl_x; //上控制限
	double lcl_r;//极差下控制限
	double ucl_r;//极差上控制限
	//标准差
	double std_within; //组间标准差
	double std_overall;  //整体标准差
	//组内
	double ppm_within_low;//组内不良率控制下限
	double ppm_within_up;//组内不良率控制上限
	double ppm_within;//组内不良率控制限（前两者之和）
	//整体
	double ppm_overall_low;//整体不良率控制下限
	double ppm_overall_up;//整体不良率控制上限
	double ppm_overall;//整体不良率控制限（前两者之和）
	//观测
	double ppm_observe_low;//超下限的不良率观测值
	double ppm_observe_up;//超上限的不良率观测值
	double ppm_observe;//整体不良率观测值（前两者之和）

	//其他指标
	double skewness;//偏度
	double kurtosis;//峰度
	double AD;//正态性检验指数
	double pValue;//p值

};

struct SciEvaluateResult_GRR
{
        int groupNum;//组数
        int personNum;//检测人员数量
        int groupSize;//组容量
        double r_bar;//极差的均值
        double x_diff;//极差
        double x_bar;//样本均值
        double std_group;
        double min_val;//最小值
        double max_val;//最大值
        double rp;//制程精密度
        double ucl_x;//标准差上控制限
        double lcl_x;//标准差下控制限
        double ucl_r;//极差上控制限
        double lcl_r;//极差下控制限
        double usl;//规格上限
        double lsl;//规格下限
        double std_coeff;//标准差系数
        int std_type;//标准差类型
        double ev;//重复性
        double av;//再现性
        double grr;//重复性与再现性指数
        double pv;//零件变异
        double tv;//全变异
        double ev_per;//重复性指数均值
        double av_per;//再现性指数均值
        double grr_per;//重复性与再现性指数均值
        double pv_per;//全变异均值
        double ndc;//数据分类数
};




typedef union 
{
	long  l;              /* 4/8 byte integer                       (input)  */
	double  f;            /* 8 byte real                            (input)  */
	char *s;              /* pointer to strings                     (input)  */
	wchar_t *ws;              /* pointer to strings                     (input)  */
} SciVal; 

struct SciVariant
{
	SciVarType type;
	SciVal par;
};




class SCI_DLL_EXPORTS SciVar  
{
	friend class SciVarArray;

public:
	SciVar(void);
	SciVar(long l);
	SciVar(int n);
	SciVar(float f);
	SciVar(double d);
	SciVar(const char *s);
	SciVar(const wchar_t *ws);
	SciVar(const SciVar &var);
	SciVar& operator = (const SciVar &var);
	
	~SciVar(void);

public:
	SciVarType ValType() const;
	double D() const;
	long L() const;
	int I() const;
	const char* S() const;
	const wchar_t* WS() const;
	float F() const;
	
public:
	// 重载类型转化
	/* operator  int(void) const;
	operator  long(void) const;
	operator  double(void) const;
	operator  const char*(void) const;
	operator  const wchar_t*(void) const; */

	SciVar operator + (const SciVar &var) const;
	SciVar operator - (const SciVar &var) const;
	SciVar operator * (const SciVar &var) const;
	SciVar operator / (const SciVar &var) const;
	SciVar operator % (const SciVar &var) const;
	bool operator != (const SciVar &var) const;
	bool operator == (const SciVar &var) const;

private:
	void ClearCtrlVal();
	void CopyCtrlVal(const SciVar &var);
	
private:
	SciVariant m_val; 
};

class SCI_DLL_EXPORTS SciVarArray
{
public:
	SciVarArray(void);
	SciVarArray(long l);
	SciVarArray(int n);
	SciVarArray(double d);
	SciVarArray(float f);
	SciVarArray(const SciVar &var);
	SciVarArray(const char *s);
	SciVarArray(const wchar_t *ws);
	SciVarArray(const SciVarArray &varArray);
	~SciVarArray(void);

public:
	int Length() const;
	void Append(const SciVar &var);
	void Remove(int index);
	void Select(int index, SciVar *var) const;
	void Replace(int index, const SciVar &var);
	void Insert(int index, const SciVar &var);
	void Clear();
	void Swap(int i, int j);
	int IndexOf(const SciVar &var, int from = 0);
	void Invert();
	void SetSize(int size);
	
	
public:
	SciVar operator [] (int index) const;
	SciVar &operator [] (int index);
	SciVarArray &operator = (const SciVarArray &varArray);
	SciVarArray &operator = ( SciVarArray &&varArray);
	bool operator != (const SciVarArray &varArray) const;
	bool operator == (const SciVarArray &varArray) const;
	SciVarArray operator + (const SciVarArray &varArray) const;

private:
	void Reset();
	void Copy(const SciVarArray &varArray);

public:
	void *pData;
};

class SCI_DLL_EXPORTS SciRun
{
public:
	SciRun();
	~SciRun();
	SciRun(int row, int start,int end);
	int& operator[] (int index);
	void operator = (const SciRun &run);
public:
	int row;
	int startCol;
	int endCol;
};
class SCI_DLL_EXPORTS SciRunArray
{
public:
	SciRunArray();
	~SciRunArray();
	SciRunArray(const SciRunArray& RunArray);
	

public:
	int  Length() const;
	void Append(SciRun &Run);
	void Append(SciRunArray &RunArray);
	void Remove(int index);
	void Select(int index, SciRun *DMCode) const;
	void Replace(int index, SciRun &DMCode);
	void Insert(int index, SciRun &DMCode);
	void Clear();
	void Swap(int i, int j);
	void SetSize(int size);

public:
	SciRun operator  [] (int index) const;
	SciRun &operator [] (int index);
	SciRunArray operator = (const SciRunArray &RunArray);
	SciRunArray operator = (SciRunArray &&RunArray);

public:
	void *pData;
};
class SCI_DLL_EXPORTS SciFont
{
public:
	SciFont();
	SciFont(SciVar &faceName,long size);
	~SciFont();


public:
	SciVar faceName;
	long size;
	long weight;
	bool bold;
	unsigned char italic;
	unsigned char underline;
	unsigned char strikeOut;
};
class SCI_DLL_EXPORTS SciPoint
{
public:
	SciPoint(void);
	SciPoint(const SciPoint &point);
	SciPoint(double pointX, double pointY);
	~SciPoint(void);

public:
    void Reset(double newX, double newY);

    void operator = (const SciPoint &point);
	SciPoint operator + (const SciPoint &point) const;
	SciPoint operator - (const SciPoint &point) const;

public:
	double x;
	double y;
};

class SCI_DLL_EXPORTS SciPointArray
{
public:
	SciPointArray(void);
	SciPointArray(const SciPointArray& pointArray);
	~SciPointArray(void);

public:
	int  Length() const;
	void Append(SciPoint &point);
	void Append(SciPointArray &pointArray);
	void Remove(int index);
	void Select(int index, SciPoint *point) const;
	void Replace(int index, SciPoint &point);
	void Insert(int index, SciPoint &point);
	void Clear();
	void Swap(int i, int j);
	void SetSize(int size);

public:
	SciPoint operator [] (int index) const;
	SciPoint &operator [] (int index);
	SciPointArray operator = (const SciPointArray &pointArray);
	SciPointArray operator = (SciPointArray &&pointArray);

public:
	void *pData;
};



class SCI_DLL_EXPORTS SciLine
{
public:
	SciLine(void);
    SciLine(const SciLine &line);
	SciLine(SciPoint start, SciPoint end);
	SciLine(double startX, double startY, double endX, double endY);
	~SciLine(void);

public:
	
    double Length();
	double VerticalAngle();
	double HorizonalAngle();
	void   MidPoint(SciPoint *midP);

public:
	SciPoint m_startPoint;
	SciPoint m_endPoint;
};

class SCI_DLL_EXPORTS SciCircle
{
public:
	SciCircle(void);
    SciCircle(const SciCircle &circle);
	SciCircle(SciPoint center, double r);
	SciCircle(double centerX, double centerY, double r);
	~SciCircle(void);

public:

	double Perimeter();
	double Area();

public:
	SciPoint m_center;
	double   m_radius;
};

class SCI_DLL_EXPORTS SciContour
{
public:
	SciContour(void);
	SciContour(const SciContour &contour);
	~SciContour(void);

public:
	SciContour& operator = (const SciContour &contour);
	SciContour& operator = (SciContour &&contour);
	
public:
	int   Length() const;
	double Perimeter() const;
    double Area() const; 
	void ToPointArray(SciPointArray *pointArray);
	void FromPointArray(SciPointArray &pointArray);
public:
	void *pData;
};

class SCI_DLL_EXPORTS SciContourArray
{
public:
	SciContourArray(void);
	SciContourArray(const SciContourArray &contourArray);
	~SciContourArray(void);

public:
	int Length() const;
	void Append(SciContour &contour);
	void Append(SciContourArray &contourArray);
	void Remove(int index);
	void Select(int index, SciContour *contour) const;
	void Replace(int index, SciContour &contour);
	void Insert(int index, SciContour &contour);
	void Clear();
	void Swap(int i, int j);

public:
	SciContour operator [] (int index) const;
	SciContourArray& operator = (const SciContourArray &contour);
	SciContourArray& operator = (SciContourArray &&contour);


public:
	void *pData;
};

class SCI_DLL_EXPORTS SciImage
{
public:
	SciImage(void);
	SciImage(const SciImage &image);
	SciImage(unsigned char* srcImageData,int step, int rows, int cols, int channel, SciImageType depth);
	~SciImage(void);

public:
	int Width() const;
	int Height() const;
	int Step() const;
	SciImage DeepCopy() const;
	SciImage ShallowCopy() const;
	/*int ImageType() const;*/
	SciImageType BitDepth() const;
	int Channels() const;
	unsigned char* ImageData();
	bool ReadImage(const char *filePath);
	bool ReadImage(const wchar_t *filePath);
	bool SaveImage(const char *filePath,int compression=6);//compress range[0,10],for png & jpg
	bool SaveImage(const wchar_t *filePath, int compression = 6);
	bool CreateImage(unsigned char* srcImageData,int step, int rows, int cols, int channel, SciImageType depth);
public:
	SciImage &operator = (const SciImage &image);

public:
	void *pData;
};



class SCI_DLL_EXPORTS SciImageArray
{
public:
	SciImageArray(void);
	SciImageArray(const SciImageArray &imageArray);
	~SciImageArray(void);

public:
	int Length() const;
	void Append(SciImage &image);
	void Append(SciImageArray &imageArray);
	void Remove(int index);
	void Select(int index, SciImage *image) const;
	void Replace(int index, SciImage &image);
	void Insert(int index, SciImage &image);
	void Clear();
	void Swap(int i, int j);

public:
	SciImage operator [] (int index) const;
	const SciImageArray& operator = (const SciImageArray &imageArray);
	const SciImageArray& operator = (SciImageArray &&imageArray);

public:
	void *pData;
};
class SCI_DLL_EXPORTS  SciMatrix
{
public:
	SciMatrix();
	SciMatrix(void* data, int rows, int cols, SciDataType type);
	~SciMatrix();
	SciMatrix(const SciMatrix &res);
	SciMatrix(int rows, int cols, SciDataType type);
	void SetMatrix(int rows, int cols, SciDataType type);
	void SetTo(SciVar var);
	int Rows() const;
	int Cols() const;
	SciMatrix DeepCopy() const;
	SciMatrix ShallowCopy() const;
	SciDataType  Type() const;
	void Select(int row, int col, SciVar *var);
	void Replace(int row, int col, SciVar &var);
	void* MatrixData()const;
	void Clear();
	
public:
	SciMatrix & operator=(const SciMatrix &res);
public:
	void *pData;
};

class SCI_DLL_EXPORTS SciMatrixArray
{
public:
	SciMatrixArray();
	SciMatrixArray(const SciMatrixArray &matrixArray);
	~SciMatrixArray();
public:
	int Length() const;
	void Append(SciMatrix &matrix);
	void Append(SciMatrixArray &matrixArray);
	void Remove(int index);
	void Select(int index, SciMatrix *matrix) const;
	void Replace(int index, SciMatrix &matrix);
	void Insert(int index, SciMatrix &matrix);
	void Clear();
	void Swap(int i, int j);

public:
	SciMatrix operator [] (int index) const;
	const SciMatrixArray& operator = (const SciMatrixArray &matrixArray);
	const SciMatrixArray& operator = (SciMatrixArray &&matrixArray);

public:
	void *pData;
};
class SCI_DLL_EXPORTS SciROI
{
public:
	SciROI(void);
	SciROI(int value);
	SciROI(const SciROI &ROI);
	~SciROI(void);

public:
	void GenPoint(SciPoint &point);
	void GenRect1(SciPoint &topLeftPoint, SciPoint &bottomRightPoint);
	void GenCircle(SciPoint &centerPoint, double radius);
	void GenTorus(SciPoint &centerPoint, double innerRadius, double outerRadius, 
				 double startAngle, double spanAngle);
	void GenRect2(SciPoint &centerPoint, double width, double height, double angle);
	void GenLine(SciPoint &startPoint, SciPoint &endPoint);
	void GenEllipse(SciPoint &centerPoint, double ra, double rb, double angle);
	void GenArc(SciPoint &centerPoint, double radius, double startAngle, double spanAngle);
	void GenPolygon(SciVarArray &arrayX, SciVarArray &arrayY);
	void GenPolygon(SciPointArray &pointArray);
	void GenIrregular(SciPointArray &pointArray);
	void GenMask(SciRunArray &runArray,int width,int height);
	

	bool GetPoint(SciPoint *point);
	bool GetRect1(SciPoint *topLeftPoint, SciPoint *bottomRightPoint) const;
	bool GetCircle(SciPoint *centerPoint, double *radius) const;
	bool GetTorus(SciPoint *centerPoint, double *innerRadius, double *outerRadius, 
					double *startAngle, double *spanAngle) const;
	bool GetRect2(SciPoint *centerPoint, double *width, double *height, double *angle) const;
	bool GetLine(SciPoint *startPoint, SciPoint *endPoint) const;
	bool GetEllipse(SciPoint *centerPoint, double *ra, double *rb, double *angle) const;
	bool GetArc(SciPoint *centerPoint, double *radius, double *startAngle, double *spanAngle) const;
	bool GetPolygon(SciVarArray *arrayX, SciVarArray *arrayY) const;
	bool GetPolygon(SciPointArray *pointArray) const;
	bool GetIrregular(SciPointArray *pointArray) const;
	bool GetMask(SciRunArray* runArray,int *width,int *height)const;
	
	SciROIType ROIType() const;
    void Reset(void);
  /*  bool IsOutBound(int imageHeight, int imageWidth)const;*/
public:
	SciROI &operator = (const SciROI &ROI);

public:
	void* pData;
};


class SCI_DLL_EXPORTS SciROIArray
{
public:
	SciROIArray(void);
	SciROIArray(const SciROIArray &ROIArray);
	~SciROIArray(void);

public:
	int Length() const;
	void Append(SciROI &ROI);
	void Append(SciROIArray &ROIArray);
	void Remove(int index);
	void Select(int index, SciROI *ROI) const;
	void Replace(int index, SciROI &ROI);
	void Insert(int index, SciROI &ROI);
	void Clear();
	void Swap(int i, int j);

public:
	SciROI operator [] (int index) const;
	const SciROIArray& operator = (const SciROIArray &ROIArray);

public:
	void *pData;
};

class SCI_DLL_EXPORTS SciRegion
{
public:
	SciRegion(void);
	SciRegion(const SciRegion &region);
	SciRegion(int width,int height,SciRunArray &runArray);
	SciRegion(SciVarArray &rows,SciVarArray &columnBegin,SciVarArray &columnEnd);
	SciRegion(int width,int height,SciVarArray &rows, SciVarArray &columnBegin, SciVarArray &columnEnd);
	~SciRegion(void);

public:
	SciRegion &operator = (const SciRegion &region);
	SciRegion &operator = (SciRegion &&region);
	void SetWidth(int width);
	void SetHeight(int height);
	void SetRuns(SciRunArray &runArray);
	void SetRuns(SciVarArray &rows, SciVarArray &columnBegin, SciVarArray &columnEnd);
	int Width()const;
	int Height()const;
	void GetRegionRuns(SciVarArray *rows, SciVarArray *columnBegin, SciVarArray *columnEnd);
	void GetRegionRuns(SciRunArray *runArray);
	void CreateRegion(int width, int height, SciVarArray &rows, SciVarArray &columnBegin, SciVarArray &columnEnd);
	

public:
	void* pData;
};

class SCI_DLL_EXPORTS SciRegionArray
{
public:
	SciRegionArray(void);
	SciRegionArray(const SciRegionArray &regionArray);
	~SciRegionArray(void);
	
public:
	int Length() const;
	void Append(SciRegion &region);
	void Append(SciRegionArray &regionArray);
	void Remove(int index);
	void Select(int index, SciRegion *region);
	void Replace(int index, SciRegion &region);
	void Insert(int index, SciRegion &region);
	void Clear();
	void Swap(int i, int j);
	void Union(SciRegion *region);

public:
	SciRegion operator [] (int index) const;
	SciRegionArray &operator = (const SciRegionArray &regionArray);
	SciRegionArray &operator = (SciRegionArray &&regionArray);

public:
	void *pData;
};

class SCI_DLL_EXPORTS SciOverlay
{
public:
	SciOverlay(void);
	SciOverlay(const SciOverlay &overlay);
	~SciOverlay(void);

public:
	void FromROI(const SciROI &ROI);
	void FromContour(const SciContour &contour);

	void GenPoint(SciPoint &point);
	void GenLine(SciPoint &startPoint, SciPoint &endPoint);
	void GenArrowLine(SciPoint &startPoint, SciPoint &endPoint);
	void GenCircle(SciPoint &centerPoint, double radius);
	void GenRect1(SciPoint &topLeftPoint, SciPoint &bottomRightPoint);
	void GenRakeRect1(SciPoint &topLeftPoint, SciPoint &bottomRightPoint, int direction, int count);
	void GenEllipse(SciPoint &centerPoint, double ra, double rb, double angle);
	void GenArc(SciPoint &centerPoint, double radius, double startAngle, double spanAngle);
	void GenPolygon(const SciPointArray &pointArray);
	void GenPolyLine(const SciPointArray &pointArray);
	void GenIrregular(const SciPointArray &pointArray);
	void GenTorus(SciPoint &centerPoint, double innerRadius, double outerRadius, 
		double startAngle, double spanAngle);
	void GenSpokeTorus(SciPoint &centerPoint, double innerRadius, double outerRadius, 
		double startAngle, double spanAngle, int direction, int count);
	void GenRect2(SciPoint &centerPoint, double width, double height, double angle);
	void GenRakeRect2(SciPoint &centerPoint, double width, double height, double angle, int direction, int count);
	void GenText(SciPoint &topLeftPoint, const char* text, SciFont &font);
	void GenText(SciPoint &topLeftPoint, const wchar_t* text, SciFont &font);
	void GenImage(SciPoint &topLeftPoint, SciImage &image);
	void GenRegion(SciRegion &region);
	void SetPen(long red, long green, long blue, long lineWidth);
	void SetBrush(long red, long green, long blue, long alpha);

	bool GetPoint(SciPoint *point);
	bool GetLine(SciPoint *startPoint, SciPoint *endPoint);
	bool GetArrowLine(SciPoint *startPoint, SciPoint *endPoint);
	bool GetCircle(SciPoint *centerPoint, double *radius);
	bool GetRect1(SciPoint *topLeftPoint, SciPoint *bottomRightPoint);
	bool GetRakeRect1(SciPoint *topLeftPoint, SciPoint *bottomRightPoint, int *direction, int *count);
	bool GetEllipse(SciPoint *centerPoint, double *ra, double *rb, double *angle);
	bool GetArc(SciPoint *centerPoint, double *radius, double *startAngle, double *spanAngle);
	bool GetPolygon(SciPointArray* pointArray);
	bool GetPolyLine(SciPointArray* pointArray);
	bool GetIrregular(SciPointArray* pointArray);
	bool GetTorus(SciPoint *centerPoint, double *innerRadius, double *outerRadius, 
		double *startAngle, double *spanAngle);
	bool GetSpokeTorus(SciPoint *centerPoint, double *innerRadius, double *outerRadius, 
		double *startAngle, double *spanAngle, int *direction, int *count);
	bool GetRect2(SciPoint *centerPoint, double *width, double *height, double *angle);
	bool GetRakeRect2(SciPoint *centerPoint, double *width, double *height, double *angle, int *direction, int *count);
	bool GetText(SciPoint *topLeftPoint, SciVar *text, SciFont *font = NULL);
	bool GetImage(SciPoint *topLeftPoint, SciImage *image);
	bool GetRegion(SciRegion *region);
	bool GetPen(long *red, long *green, long *blue,long *lineWidth);
	bool GetBrush(long *red, long *green, long *blue, long *alpha);
    void Reset();
	SciOverlayType OverlayType();

public:
	SciOverlay& operator = (const SciOverlay& overlay);

public:
	void* pData;
};

class SCI_DLL_EXPORTS SciOverlayPath
{
public:
	SciOverlayPath(void);
	SciOverlayPath(const SciOverlayPath& path);
	~SciOverlayPath(void);

public:
 	void AddPoint(SciPoint &point);
 	void AddLine(SciPoint &startPoint, SciPoint &endPoint);
 	void AddArrowLine(SciPoint &startPoint, SciPoint &endPoint);
 	void AddCircle(SciPoint &centerPoint, double radius);
 	void AddRect1(SciPoint &topLeftPoint, SciPoint &bottomRightPoint);
 	void AddRakeRect1(SciPoint &topLeftPoint, SciPoint &bottomRightPoint, int direction, int count);
 	void AddEllipse(SciPoint &centerPoint, double ra, double rb, double angle);
 	void AddArc(SciPoint &centerPoint, double radius, double startAngle, double spanAngle);
 	void AddPolygon(const SciPointArray &pointArray);
 	void AddIrregular(const SciPointArray &pointArray);
 	void AddTorus(SciPoint &centerPoint, double innerRadius, double outerRadius, 
 		double startAngle, double spanAngle);
 	void AddSpokeTorus(SciPoint &centerPoint, double innerRadius, double outerRadius, 
 		double startAngle, double spanAngle, int direction, int count);
 	void AddRect2(SciPoint &centerPoint, double width, double height, double angle);
 	void AddRakeRect2(SciPoint &centerPoint, double width, double height, double angle, int direction, int count);
	void AddText(SciPoint &topLeftPoint, const char *text, SciFont &font);
 	void AddText(SciPoint &topLeftPoint, const wchar_t *text, SciFont &font);
 	void AddImage(SciPoint &topLeftPoint, SciImage &image);
 	void AddRegion(SciRegion &region);
 	void AddOverlay(SciOverlay &overlay);
	void AddPath(SciOverlayPath &overlayPath);
 
	void Insert(int index, const SciOverlay& overlay);
	void Remove(int index);
	void Replace(int index, const SciOverlay& overlay);
	int   Length() const;
	SciOverlay operator [] (int index) const;
	SciOverlay &operator [] (int index);
	SciOverlayPath operator = (const SciOverlayPath &overlayPath);
 	void Clear();
 	void Reserve(const int size);
	
public:
	void* pData;
};

class SCI_DLL_EXPORTS SciMorphStructure
{
public:
	SciMorphStructure(void);
	SciMorphStructure(const SciMorphStructure &structure);
	~SciMorphStructure(void);

public:
	long CreateElement(int rows, int cols, int anchorX, int anchorY, SciMorphStructureType shape, int *data = NULL);
	long QueryInfo(int *rows, int *cols, int *anchorX, int *anchorY, SciMorphStructureType *shape, int **data);

public:
	SciMorphStructure &operator = (const SciMorphStructure &structure);

private:
	int  m_cols;
	int  m_rows;
	int  m_anchorX;
	int  m_anchorY;
	int* m_data;
	SciMorphStructureType  m_shape;
};

class SCI_DLL_EXPORTS Sci1DCode
{
public:
	Sci1DCode(void);
	~Sci1DCode(void);

public:
	SciCodeType codeType;
	SciVar codeString;
	float orientation;
	float pixelPerModule;
	SciPointArray points;
	SciBarCodeQuality15416 qualityLevel_15416;
};




class SCI_DLL_EXPORTS SciQRCode
{
public:
	SciQRCode(void);
	~SciQRCode(void);

public:
	SciCodeType codeType;		
	SciVar codeString;	
	SciVar subType;	
	SciVar polarity;	
	SciVar errorLevel;	
	SciVar mirror;
	int contrast;
	int	version;		
	int	symbolRows;		
	int	symbolCols;		
	double moduleSize;
	double orientation;
	SciPointArray backGround;
	SciPointArray foreGround;
	SciPointArray ErrorForePoints;//前景错误点
	SciPointArray ErrorBackPoints;
	SciPointArray points;		
	SciQRCodeQuality15415 qualityLevel_15415;
	SciQRCodeQuality29158 qualityLevel_29158;
};



class SCI_DLL_EXPORTS SciQRCodeArray
{
public:
	SciQRCodeArray();
	SciQRCodeArray(const SciQRCodeArray& QRCodeArray);
	~SciQRCodeArray();

public:
	int  Length() const;
	void Append(SciQRCode &QRCode);
	void Append(SciQRCodeArray &QRCodeArray);
	void Remove(int index);
	void Select(int index, SciQRCode *QRCode) const;
	void Replace(int index, SciQRCode &QRCode);
	void Insert(int index, SciQRCode &QRCode);
	void Clear();
	void Swap(int i, int j);

public:
	SciQRCode operator  [] (int index) const;
	SciQRCode &operator [] (int index);
	SciQRCodeArray operator = (const SciQRCodeArray &QRCodeArray);
	SciQRCodeArray operator = (SciQRCodeArray &&QRCodeArray);

private:
	void *pData;
};

class SCI_DLL_EXPORTS SciVCode
{
public:
	SciVCode();
	~SciVCode();
public:
	int symbolRows;
	int symbolCols;
	int EDAC;
	float moduleHeight;
	float moduleWidth;
	float orientation;
	SciVar mirror;
	SciVar codeType;
	SciVar shape;
	SciVar codeString;
	SciPointArray points;
};

class SCI_DLL_EXPORTS SciVCodeArray
{
public:
	SciVCodeArray();
	SciVCodeArray(const SciVCodeArray& VCodeArray);
	~SciVCodeArray();

	int  Length() const;
	void Append(SciVCode &VCode);
	void Append(SciVCodeArray &VCodeArray);
	void Remove(int index);
	void Select(int index, SciVCode *VCode) const;
	void Replace(int index, SciVCode &VCode);
	void Insert(int index, SciVCode &VCode);
	void Clear();
	void Swap(int i, int j);

public:
	SciVCode operator  [] (int index) const;
	SciVCode &operator [] (int index);
	SciVCodeArray operator = (const SciVCodeArray &VCodeArray);
	SciVCodeArray operator = (SciVCodeArray &&VCodeArray);

private:
	void *pData;
};


class SCI_DLL_EXPORTS Sci1DCodeArray
{
public:
	Sci1DCodeArray(void);
	Sci1DCodeArray(const Sci1DCodeArray& Code1DArray);
	~Sci1DCodeArray(void);

public:
	int  Length () const;
	void Append (Sci1DCode &Code1D);
	void Append (Sci1DCodeArray &Code1DArray);
	void Remove (int index);
	void Select (int index, Sci1DCode *Code1D) const;
	void Replace(int index, Sci1DCode &Code1D);
	void Insert (int index, Sci1DCode &Code1D);
	void Clear();
	void Swap(int i, int j);

public:
	Sci1DCode operator  [] (int index) const;
	Sci1DCode &operator [] (int index);
	Sci1DCodeArray operator = (const Sci1DCodeArray &Code1DArray);
	Sci1DCodeArray operator = (Sci1DCodeArray &&Code1DArray);

private:
	void *pData;
};

class SCI_DLL_EXPORTS SciDMCode
{
public:
	SciDMCode(void);
	~SciDMCode(void);

public:
	SciCodeType codeType;		
	SciVar codeString;	
	SciVar subType;	
	SciVar polarity;	
	SciVar shape;	
	SciVar mirror;
	int contrast;
	int	symbolRows;		
	int symbolCols;		
	double moduleSize;	
	double orientation;
	SciPointArray backGround;
	SciPointArray foreGround;
	SciPointArray ErrorForePoints;//前景错误点
	SciPointArray ErrorBackPoints;//背景错误点
	SciPointArray points;		
	SciDMCodeQuality15415 qualityLevel_15415;
	SciDMCodeQuality29158 qualityLevel_29158;
	SciDMCodeQualityAS9132 qualityLevel_9132;
};
	

class SCI_DLL_EXPORTS SciDMCodeArray
{
public:
	SciDMCodeArray();
	SciDMCodeArray(const SciDMCodeArray& DMCodeArray);
	~SciDMCodeArray();

public:
	int  Length() const;
	void Append(SciDMCode &DMCode);
	void Append(SciDMCodeArray &DMCodeArray);
	void Remove(int index);
	void Select(int index, SciDMCode *DMCode) const;
	void Replace(int index, SciDMCode &DMCode);
	void Insert(int index, SciDMCode &DMCode);
	void Clear();
	void Swap(int i, int j);

public:
	SciDMCode operator  [] (int index) const;
	SciDMCode &operator [] (int index);
	SciDMCodeArray operator = (const SciDMCodeArray &DMCodeArray);
	SciDMCodeArray operator = (SciDMCodeArray &&DMCodeArray);

private:
	void *pData;
};

class SCI_DLL_EXPORTS SciPDF417Code
{
public:
	SciPDF417Code(void);
	~SciPDF417Code(void);

public:
	SciCodeType codeType;
	SciVar codeString;
	SciVar polarity;
	SciVar mirror;
	int symbolRows;
	int	symbolCols;
	int	errorLevel;
	double moduleWidth;
	double moduleHeight;
	double orientation;
	SciPointArray points;
	SciPDF417CodeQuality15415 qualityLevel_15415;
};
class SCI_DLL_EXPORTS SciPDF417CodeArray
{
public:
	SciPDF417CodeArray();
	SciPDF417CodeArray(const SciPDF417CodeArray& PDF417CodeArray);
	~SciPDF417CodeArray();

public:
	int  Length() const;
	void Append(SciPDF417Code &PDF417Code);
	void Append(SciPDF417CodeArray &PDF417CodeArray);
	void Remove(int index);
	void Select(int index, SciPDF417Code *PDF417Code) const;
	void Replace(int index, SciPDF417Code &PDF417Code);
	void Insert(int index, SciPDF417Code &PDF417Code);
	void Clear();
	void Swap(int i, int j);

public:
	SciPDF417Code operator  [] (int index) const;
	SciPDF417Code &operator [] (int index);
	SciPDF417CodeArray operator = (const SciPDF417CodeArray &PDF417CodeArray);
	SciPDF417CodeArray operator = (SciPDF417CodeArray &&PDF417CodeArray);

private:
	void *pData;

};

class SCI_DLL_EXPORTS SciFeaturePoint
{
public:
	SciFeaturePoint(void);
	SciFeaturePoint(const float _x, const float _y, const float _response);
	SciFeaturePoint(const float _x, const float _y, const float _scale, const int _octave, const float _response);
	SciFeaturePoint(const float _x, const float _y, const float _dx, const float _dy, const float _scale, const int _octave, const float _response);

	~SciFeaturePoint(void);

public:
	inline SciFeaturePoint& operator= (const SciFeaturePoint &keypoint);

public:
	float x;
	float y;
	float dx;
	float dy;
	float scale;
	float angle;
	float response;
	int octave;
};

class SCI_DLL_EXPORTS SciFeaturePointArray
{
public:
	SciFeaturePointArray(void);
	SciFeaturePointArray(const SciFeaturePointArray& FeaturePointArray);
	~SciFeaturePointArray(void);

public:
	int  Length () const;
	void Append (SciFeaturePoint &FeaturePoint);
	void Append (SciFeaturePointArray &FeaturePointArray);
	void Remove (int index);
	void Select (int index, SciFeaturePoint *FeaturePoint) const;
	void Replace(int index, SciFeaturePoint &FeaturePoint);
	void Insert (int index, SciFeaturePoint &FeaturePoint);
	void Clear();
	void Swap(int i, int j);

public:
	SciFeaturePoint operator  [] (int index) const;
	SciFeaturePoint &operator [] (int index);
	SciFeaturePointArray operator = (const SciFeaturePointArray &FeaturePointArray);
	SciFeaturePointArray operator = (SciFeaturePointArray &&FeaturePointArray);

public:
	void *pData;
};

class SCI_DLL_EXPORTS SciFeatureDescriptor
{
public:
	SciFeatureDescriptor(void);
	SciFeatureDescriptor(const SciFeatureDescriptor &FeatureDescriptor);
	~SciFeatureDescriptor(void);

public:
	int Col() const;
	int Row() const;
	unsigned char* MatData();

public:
	SciFeatureDescriptor &operator = (const SciFeatureDescriptor &FeatureDescriptor);

public:
	void *pData;
};

class SCI_DLL_EXPORTS Sci2DVarArray
{
public:
	Sci2DVarArray(void);
	Sci2DVarArray(const Sci2DVarArray& _2DVarArray);
	~Sci2DVarArray(void);

public:
	int  Length () const;
	void Append (SciVarArray &VarArray);
	void Append (Sci2DVarArray &_2DVarArray);
	void Remove (int index);
	void Select (int index, SciVarArray *VarArray) const;
	void Replace(int index, SciVarArray &VarArray);
	void Insert (int index, SciVarArray &VarArray);
	void Clear();
	void Swap(int i, int j);

public:
	SciVarArray operator  [] (int index) const;
	SciVarArray &operator [] (int index);
	Sci2DVarArray operator = (const Sci2DVarArray &_2DVarArray);
	Sci2DVarArray operator = (Sci2DVarArray &&_2DVarArray);

public:
	void *pData;
};
class SCI_DLL_EXPORTS SciScratchGroup
{
public:
	SciScratchGroup();
	~SciScratchGroup();

	SciScratchGroup(SciVar &_className);
	SciScratchGroup(const SciScratchGroup &group);
	void Clear();

	void Append(SciScratchFeature feature);
	void Insert(int index, SciScratchFeature feature);
	void Remove(int index);
	SciScratchFeature & operator[](int index)const;//
	SciScratchFeature & operator[](int index);//
	SciScratchGroup & operator=(const SciScratchGroup group);

	int  GetFeatureNum()const;
	void Sort();

public:
	SciVar className;
	void * pData;
};

class SCI_DLL_EXPORTS  SciScratchLayer
{
public:

	SciScratchLayer();
	SciScratchLayer(SciScratchPrecessing _preParam);
	SciScratchLayer(const SciScratchLayer & layer);
	SciScratchLayer & operator=(const SciScratchLayer &layer);
	~SciScratchLayer();

	void Append(SciScratchGroup group);
	void Insert(int index, SciScratchGroup group);
	void Remove(int index);
	SciScratchGroup & operator[](int index)const;
	SciScratchGroup & operator[](int index);
	void Clear();
	int  GetGroupNum()const;


public:
	SciScratchPrecessing preParam;
	void * pData;
};


class  SCI_DLL_EXPORTS SciScratchLayerArray
{
public:

	SciScratchLayerArray();
	SciScratchLayerArray(const SciScratchLayerArray & layerArray);
	SciScratchLayerArray & operator=(const  SciScratchLayerArray &layerArray);

	~SciScratchLayerArray();
	void Clear();

	void Append(SciScratchLayer & layer);
	void Insert(int index, SciScratchLayer &layer);
	void Remove(int index);
	SciScratchLayer & operator[](int index)const;
	SciScratchLayer & operator[](int index);//
	int GetLayerNum()const;




	void * pData;// 


};

class SCI_DLL_EXPORTS SciMatchModel
{
public:
	SciMatchModel(void);
	SciMatchModel(const SciMatchModel &modelID);
	~SciMatchModel(void);

	int ModelType()const;
	SciMatchModel &operator = (const SciMatchModel &modelID);
	SciMatchModel &operator = (SciMatchModel &&modelID);
	
	unsigned long long GetLenth()const; 
	void GetData(unsigned char* data) const;//
	void SetData(unsigned char* data);
public:
	void* pData;
};

class SCI_DLL_EXPORTS SciChunkData
{
public:
	SciChunkData();
	SciChunkData(const SciChunkData& chunkdata);
	SciChunkData(const unsigned char* pData, const unsigned long long length);
	~SciChunkData();

	SciChunkData& operator= (const SciChunkData& chunkData);
	bool operator!=(const SciChunkData &v) const;
	bool operator==(const SciChunkData &v) const;
	unsigned char& operator [] (int index);
	unsigned char operator [] (int index) const;

public:
	unsigned long long getLength() const;
	unsigned char* getData() const;
	void setData(const unsigned long long length, const unsigned char* pData);

private:
	void* pVData;
};

class SCI_DLL_EXPORTS SciString
{
public:
	SciString();
	SciString(const SciString& ss);
	SciString(const char *s, const unsigned int length = 0);
	~SciString();

public:
	SciString& operator = (const char* var);
	SciString& operator = (const SciString &var);
	SciString& operator = (SciString&& var);
	SciString& operator = (const char var);
	bool operator != (const SciString &var) const;
	bool operator == (const SciString &var) const;
	SciString operator + (const SciString &var) const;
	SciString& operator += (const SciString& var);

public:
	void setStr(const char* str);
	const char* getStr() const;
	const int length() const;
	void clear();

private:
	void* pVData;
};

class SCI_DLL_EXPORTS SciStringArray
{
public:
	SciStringArray();
	SciStringArray(const SciString& var);
	SciStringArray(const SciStringArray& varArray);
	~SciStringArray();

public:
	SciString& operator [] (int index);
	SciString operator [] (int index) const;
	SciStringArray& operator = (const SciStringArray& varArray);
	bool operator != (const SciStringArray &varArray) const;
	bool operator == (const SciStringArray &varArray) const;
	SciStringArray operator += (const SciStringArray &varArray) const;

public:
	int length();
	void push_back(const SciString& var);
	void push_back(const SciStringArray &varArray);
	bool removeAt(unsigned int index);
	bool select(unsigned int index, SciString* var) const;
	bool replace(unsigned int index, const SciString& var);
	bool insert(unsigned int index, const SciString& var);
	void clear();
	bool swap(unsigned int i, unsigned int j);
	void setSize(unsigned int size);

private:
	void* pVData;
};


struct SciMatrixCodeResult
{
	SciCodeType type;
	Sci1DCodeArray barCode;
	SciDMCodeArray dmCode;
	SciQRCodeArray qrCode;
	SciPDF417CodeArray pdf417Code;
};

#endif
